using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Utility;
using DTO;

namespace BUS
{
  public  class tbloainguoidungBUS
    {
      public static tbloainguoidungcollection Get(string where,
      int pageindex,
      int pagesize,
      string orderby,
      string orderdirection,
      out int total)
      {
          tbloainguoidungDAL loainguoidungDAL = new tbloainguoidungDAL();
          return loainguoidungDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
      }
        public static tbloainguoidungcollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbloainguoidungDAL loainguoidungDAL = new tbloainguoidungDAL();
            return loainguoidungDAL.Get(cri.Criter, 0, 0, loainguoidungcolumns.maloainguoidung.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbloainguoidung GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, loainguoidungcolumns.maloainguoidung.ToString(), Condition.EQUAL, iD);
            tbloainguoidungDAL loainguoidungDAL = new tbloainguoidungDAL();
            tbloainguoidungcollection loainguoidungcollection = loainguoidungDAL.Get(cri.Criter,
                     0, 0, loainguoidungcolumns.maloainguoidung.ToString(), OrderDirection.ASC.ToString(), out total);
            if (loainguoidungcollection.Count > 0)
                return loainguoidungcollection[0];
            return null;
        }
    }
}
